﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter13.Code03.Code03.Example03
{
    public class Demo
    {
        public static void Begin()
        {
            Connection myConnection1 = new Connection();
            myConnection1.Name = "First Connection.";
            Connection myConnection2 = new Connection();
            myConnection2.Name = "Second Connection.";
            Display myDisplay = new Display();
            myConnection1.MessageArrived += myDisplay.DisplayMessage;
            myConnection2.MessageArrived += myDisplay.DisplayMessage;
            myConnection1.Connect();
            myConnection2.Connect();
            Console.ReadLine();
            myConnection1.Disconnect();
            myConnection2.Disconnect();
        }
    }
}
